package P2;

import java.util.Date;

public class ControlPanel {
    private String password = "1234";
    private int maxAttempts = 3;
    private int attempts = 0;
    private boolean locked = false;
    private long lockEndTime = 0;

    private long keepLockTime=120;
    private ControlPanelState currentState = new ReadCharacterState();

    public void enterPassword(String inputPassword) {
        currentState.enterPassword(this, inputPassword);
    }

    // 其他相关的getter和setter方法

    public void changeState(ControlPanelState newState) {
        currentState = newState;
    }

    public boolean isLocked() {

        return this.locked;
    }

    public long getLockEndTime() {
        return this.lockEndTime;
    }

    public void unlock() {
        this.locked=false;
    }

    public void setAttempts(int i) {
        this.attempts=i;
    }

    public String getPassword() {
        return this.password;
    }

    public void lock() {
        this.locked=true;
    }

    public long getLockoutTime() {
       return this.keepLockTime;
    }

    public void incrementAttempts() {
        this.attempts+=1;
    }

    public int getAttempts() {
        return this.attempts;
    }

    public int getMaxAttempts() {
        return this.maxAttempts;
    }

    public void setLockEndTime(long l) {
        this.lockEndTime=l;
    }
}
